package LeetCode.month01.day01;

import java.util.Scanner;
import java.util.*;
public class No125 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        System.out.println(isPalindrome(s));
    }

    public static boolean isPalindrome(String s) {
        int left=0,right=s.length()-1;
        while(left<right){
            if(!Character.isLetterOrDigit(s.charAt(left))){
                left++;
            }else if(!Character.isLetterOrDigit(s.charAt(right))){
                right--;
            }else if(Character.toLowerCase(s.charAt(left))==Character.toLowerCase(s.charAt(right))){
                left++;
                right--;
            }else{
                return false;
            }
        }
        return true;
//        s = s.toLowerCase();
//        char ch1=' ';
//        char ch2=' ';
//        int left = 0, right = s.length() - 1;
//        while (left <= right) {
//             ch1 = s.charAt(left);
//             ch2 = s.charAt(right);
//            if (!Character.isDigit(ch1)&&!Character.isAlphabetic(ch1)) {
//                left++;
//                continue;
//            }
//            if (!Character.isDigit(ch2)&&!Character.isAlphabetic(ch2)) {
//                right--;
//                continue;
//            }
//            if (ch1 != ch2) {
//                return false;
//            }
//            if (ch1 == ch2) {
//                left++;
//                right--;
//            }
//        }
//        return true;
    }
}
